<%--
  Created by IntelliJ IDEA.
  User: Snakewood
  Date: 2020/12/29
  Time: 13:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <title>Title</title>

    <style>

        img{
            width: 4cm;
            height: 4cm;
        }
        a{text-decoration: none;}

    </style>
    <link type="text/css" rel="stylesheet" href="css/leibiebiankuang.css">
    <link type="text/css" rel="stylesheet" href="css/totop.css">
</head>
<body>
<%@include file="totop.jsp"%>
<%@include file="head.jsp"%>
<%@include file="search.jsp"%>
<table style="text-align: center;margin: auto;">
    <tr>
        <td>
            <form action="cart?op=search" style="text-align: center">
            <input type="hidden" name="op" value="search">
            <input type="submit" value="查询所有订单">
            </form>
        </td>
        <td>
            <form action="cart?op=searchbuy" style="text-align: center">
            <input type="hidden" name="op" value="searchbuy">
            <input type="submit" value="查询已购买订单">
            </form>
        </td>
        <td>
            <form action="cart?op=searchnotbuy" style="text-align: center">
            <input type="hidden" name="op" value="searchnotbuy">
            <input type="submit" value="查询未购买订单">
            </form>
        </td>
    </tr>
</table>



<div style="text-align: center">
    <table border="1"     cellspacing="0"    bordercolor="#00CCCC" style="margin: auto">
        <tr align="right">
            <td colspan="7">
                <c:if test="${empty user}">
                    <span>
                        <a style="font-size: 12px" href="login.jsp">您尚未登录，请登录！</a>&nbsp;&nbsp;&nbsp;
                        <a style="font-size: 12px" href="regist.jsp">还没有账号？点此注册！</a>
                    </span>
                </c:if>
                <c:if test="${not empty user}">
                    ${user.username}(uid:${user.uid}),你好！
                </c:if>
            </td>
        </tr>

        <tr>
            <td>序号</td>
            <td>图片</td>
            <td>零食名称</td>
            <td>口味</td>
            <td>价格</td>

            <td>购买数量</td>
            <td>物品状况</td>
            <td>购买时间</td>
            <td>操作</td>
        </tr>
        <c:forEach items="${cartList}" var="m" varStatus="s">
            <tr>
                <td>${s.index+1}</td>
                <td><img src="${m.cpic}"></td>
                <td>${m.cfname}</td>
                <td>${m.cflavor}</td>
                <td>${m.cprice}</td>

                <td>${m.number}${m.cunit}</td>
                <td>${m.isbuy}</td>
                <td>${m.buytime}</td>
                <td>
                    <c:choose>
                        <c:when test="${m.isbuy==true}">
                            <a href="cart?op=look&fid=${m.cfid}&isbuy=1">查看</a><br><br>
                            <a href="cart?op=delete&fid=${m.cfid}&uid=${m.cuid}&buytime=${m.buytime}">删除</a><br><br>
                        </c:when>
                        <c:when test="${m.isbuy==false}">
                            <a href="cart?op=look&fid=${m.cfid}&isbuy=0">查看</a><br><br>
                            <a href="cart?op=buy&fid=${m.cfid}&uid=${m.cuid}">购买</a><br><br>
                            <a href="cart?op=delete&fid=${m.cfid}&uid=${m.cuid}&buytime=${m.buytime}">删除</a>
                        </c:when>
                    </c:choose>
                </td>
            </tr>
        </c:forEach>
    </table>
</div>
</body>
</html>
